<?

/*			MODULES JS COMPILER			
*	Retreive single css includes
*	To do: compress css files.		*/


header("Cache-Control: max-age=43200, must-revalidate");
header('Content-type: text/css');


if( $mods = $DB->pregstring( $_GET['mods'], "/[^\d\,]/" )) {

	if( $mods = $DB->query("select json from moddump where ID in($mods)", true) )
		while( $mod = mysql_fetch_array( $mods, MYSQL_ASSOC)) {
			
			$vars = json_decode( $mod[ 'json' ]);
			
			if( !$exists[ $vars->mod ] ) {
			
				if( file_exists ($path = ROOT . ACCOUNT ."/custom.root/modules/{$vars->mod}/style.css")) include $path;
				else if( file_exists ($path = ENGINE_CORE . "modules/{$vars->mod}/style.css")) include $path;
			
				$exists[ $vars->mod ] = true;
			} 
		}

} else if( $single = $DB->simplestring( $_GET['single'] )) {

	if( file_exists ($path = ROOT . ACCOUNT ."/../custom.root/modules/$single/style.css")) include $path;
	else if( file_exists ($path = ENGINE_CORE . "modules/$single/style.css")) include $path;

}

?>